{include file="mobile_header" title="登陆" /}
<style type="text/css">
	.container{
		background: url('__FROZENUI_IMG__/login2.jpg') no-repeat -1200px,0px;
		height: 6.2rem;
	}
	
	#tab{
		margin-top:1.2rem ;
	}
	#tab .ui-form{
		margin:20px;
		padding: 10px;
		background: rgba(255,255,255,0.1);
		border-radius: 5px;
	}
	.ui-btn-wrap{
		margin: 20px;
		padding: 0px !important;
	}
	
	#login_btn{
		background: rgba(255,255,255,0.1);
		color: #fff;
		padding: 0 10px;
	}
	.ui-form-item input{
		color: #fff;
	}
	
</style>
    <body ontouchstart="">
        <header class="ui-header ui-header-positive ui-border-b">
            <h1>登陆</h1>
        </header>
        <section class="ui-container container">
            <section id="tab">
            <div class="ui-form ui-border-t">
                <form action="javascript:void(0);">
                    <div class="ui-form-item ui-form-item-pure ui-border-b">
                        <input id="username" type="text" placeholder="账号">
                    </div>
                    <div class="ui-form-item ui-form-item-pure ui-border-b">
                        <input id="password" type="password" placeholder="密码">
                    </div>
                    <div class="ui-form-item ui-form-item-r ui-border-b">
			            <input type="text" placeholder="请输入验证码" id="code" name="code">
			            <!-- 若按钮不可点击则添加 disabled 类 -->
			            <button type="button" class="ui-border-l">
			            	<img src="{:url('admin/login/checkVerify')}" onclick="javascript:this.src='{:url('admin/login/checkVerify')}?tm='+Math.random();" style="float:right;cursor: pointer"/>
			            </button>
			        </div>
                </form>
            </div>
            <div class="ui-btn-wrap">
		    	<button id="login_btn" class="ui-btn-lg">登录</button>
			</div>
        	</section>
        </section>
        {include file="mobile_footer" /}
        <script>
		    document.onkeydown=function(event){
		        var e = event || window.event || arguments.callee.caller.arguments[0];
		        if(e && e.keyCode==13){ // enter 键
		            $('#login_btn').click();
		        }
		    };
		    var lock = false;
		    $(function () {
		        $('#login_btn').click(function(){
		            if(lock){
		                return;
		            }
		            lock = true;
		            $('#login_btn').removeClass('btn-success').addClass('disabled').val('登陆中...');
		            var username = $('#username').val();
		            var password = $('#password').val();
		            var code = $('#code').val();
                    $.post("{:url('login/login')}",{'name':username, 'password':password, 'code':code},function(data){
                        lock = false;
                        $('#login_btn').val('登录').removeClass('btn-danger').addClass('btn-success');
                        if(data.code!=1){
                            $('#err_msg').show().html("<span style='color:red'>"+data.data+"</span>");
                            return;
                        }else{
                            console.log(data.data);
                            window.location.href=data.data;

                        }
                    });
		        });
		    });
        </script>
    </body>
</html>